#include "shell-wm.h"
#include "shell-util.h"
#include "st.h"
+#include "switcheroo-control.h"
static ShellGlobal *the_object = NULL;
gboolean has_modal;
gboolean frame_timestamps;
gboolean frame_finish_timestamp;
+
+ GDBusProxy *switcheroo_control;
+ GCancellable *switcheroo_cancellable;
};
enum {
PROP_FOCUS_MANAGER,
PROP_FRAME_TIMESTAMPS,
PROP_FRAME_FINISH_TIMESTAMP,
+ PROP_SWITCHEROO_CONTROL,
};
/* Signals */
static guint shell_global_signals [LAST_SIGNAL] = { 0 };
+static void
+switcheroo_control_ready_cb (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ ShellGlobal *global;
+ GError *error = NULL;
+ ShellNetHadessSwitcherooControl *control;
+
+ control = shell_net_hadess_switcheroo_control_proxy_new_for_bus_finish (res, &error);
+ if (!control)
+ {
+ if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+ g_debug ("Could not get switcheroo-control GDBusProxy: %s", error->message);
+ g_clear_error (&error);
+ return;
+ }
+
+ global = user_data;
+ global->switcheroo_control = G_DBUS_PROXY (control);
+ g_debug ("Got switcheroo-control proxy successfully");
+}
+
static void
shell_global_set_property(GObject *object,
guint prop_id,
case PROP_FRAME_FINISH_TIMESTAMP:
g_value_set_boolean (value, global->frame_finish_timestamp);
break;
+ case PROP_SWITCHEROO_CONTROL:
+ g_value_set_object (value, global->switcheroo_control);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
global->save_ops = g_hash_table_new_full (g_file_hash,
(GEqualFunc) g_file_equal,
g_object_unref, g_object_unref);
+
+ global->switcheroo_cancellable = g_cancellable_new ();
+ shell_net_hadess_switcheroo_control_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_NONE,
+ "net.hadess.SwitcherooControl",
+ "/net/hadess/SwitcherooControl",
+ global->switcheroo_cancellable,
+ switcheroo_control_ready_cb,
+ global);
}
static void
the_object = NULL;
+ g_cancellable_cancel (global->switcheroo_cancellable);
+ g_clear_object (&global->switcheroo_cancellable);
+
g_clear_object (&global->userdatadir_path);
g_clear_object (&global->runtime_state_path);
"Whether at the end of a frame to call glFinish and log paintCompletedTimestamp",
FALSE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (gobject_class,
+ PROP_SWITCHEROO_CONTROL,
+ g_param_spec_object ("switcheroo-control",
+ "switcheroo-control",
+ "D-Bus Proxy for switcheroo-control daemon",
+ G_TYPE_DBUS_PROXY,
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
}
/*
clutter_event_put ((ClutterEvent *)&event);
}
+/**
+ * _shell_global_get_switcheroo_control: (skip)
+ * @global: A #ShellGlobal
+ *
+ * Get the global #GDBusProxy instance for the switcheroo-control
+ * daemon.
+ *
+ * Return value: (transfer none): the #GDBusProxy for the daemon,
+ * or %NULL on error.
+ */
+GDBusProxy *
+_shell_global_get_switcheroo_control (ShellGlobal *global)
+{
+ return global->switcheroo_control;
+}
+
/**
* shell_global_get_settings:
* @global: A #ShellGlobal